package com.sync.platform.service;

import java.time.LocalDateTime;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sync.platform.entity.SyncTaskLog;

/**
 * Synchronization task log service interface
 */
public interface SyncTaskLogService extends IService<SyncTaskLog> {

    /**
     * Get logs by task ID
     *
     * @param taskId Task ID
     * @return List of task logs
     */
    List<SyncTaskLog> getLogsByTaskId(Long taskId);

    /**
     * Get recent logs for all tasks
     *
     * @param limit Maximum number of logs to return
     * @return List of recent task logs
     */
    List<SyncTaskLog> getRecentLogs(int limit);

    /**
     * Create a new task log
     *
     * @param taskId Task ID
     * @param taskType Task type
     * @param message Log message
     * @param status Execution status
     * @return Created log ID
     */
    Long createLog(Long taskId, Integer taskType, String message, Integer status);

    /**
     * Update task log with execution result
     *
     * @param logId Log ID
     * @param status Execution status
     * @param syncCount Number of records/files synchronized
     * @param message Execution message
     * @param detailLog Detailed execution log
     * @return true if update successful, false otherwise
     */
    boolean updateLog(Long logId, Integer status, Integer syncCount, String message, String detailLog);

    /**
     * Count logs between two dates
     *
     * @param startTime Start time (inclusive)
     * @param endTime End time (inclusive)
     * @return Count of logs in the date range
     */
    int countLogsBetween(LocalDateTime startTime, LocalDateTime endTime);
}
